package com.youan.serve.service.impl;

import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.youan.serve.dao.domain.Syscode;
import com.youan.serve.dao.domain.SyscodeDetail;
import com.youan.serve.dao.idao.SyscodeDetailMapper;
import com.youan.serve.dao.idao.SyscodeMapper;
import com.youan.serve.service.ISyscodeService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author auto_code
 * @since 2020-02-29
 */
@Service
public class SyscodeServiceImpl extends ServiceImpl<SyscodeMapper, Syscode> implements ISyscodeService {
    @Autowired
    private SyscodeMapper syscodeMapper;
    @Autowired
    private SyscodeDetailMapper syscodeDetailMapper;

    @Override
    public void deleteSysCodeAndSysCodeDetailsBySysCodeId(String sysCodeId) {
        //  删除syscodedetial
        syscodeDetailMapper.delete(new LambdaUpdateWrapper<SyscodeDetail>()
                .eq(SyscodeDetail::getSysCodeId, sysCodeId));
        //  删除syscode
        syscodeMapper.deleteById(sysCodeId);
    }
}
